package com.cd.dao;

import com.cd.entity.Student;
import com.cd.mapper.StudentMapper;
import com.cd.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import java.io.IOException;
import java.util.List;


public class StudentDao {

    /**
     * 1.查询所有学生信息
     * @return
     */

    public List<Student> findAll(){

        boolean autoCommit = false;
        try (SqlSession session = MybatisUtil.getSqlSession(true)) {


            StudentMapper mapper = session.getMapper(StudentMapper.class);
            return mapper.findAll();

        } catch (IOException e) {
            throw new RuntimeException(e);
        }


    }
}
